﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using App1AppHandler;

namespace Reborn_Server.App1AppHandler
{
    public class Spell_EnragingShout : TargetSpell
    {

        public void Cast(CreatureBase myCreatureBase, int CastLevel, long CreatureGUID)
        {
            List<MapItem> MapItemsWithin12;
            if (base.InitializeCast(myCreatureBase, CastLevel, CreatureGUID, false, out MapItemsWithin12) == false)
                return;

            int DamageAmount = SkillManager.AdjustForCombat(CastLevel, myCreatureBase.MaxHP / 2, CastingCreatureInt);

            foreach (CreatureBase creaturebase in myCreatureBase.currentMapItem.CreaturesBases)
            {
                if (creaturebase.HP > 0 && creaturebase is Creature &&
                    (creaturebase.Faction != myCreatureBase.Faction || myCreatureBase.hateManager.GetCreatureHateInfo(creaturebase) != null))
                {
                    int actualTaunt = Math.Min(DamageAmount, creaturebase.MaxHP / 2);

                    creaturebase.hateManager.UpdateList(myCreatureBase, actualTaunt);

                    myCreatureBase.SendMessage("You taunt " + creaturebase.Name + "!", "spelloffense");
                }
            }
        }
    }
}
